<template>
  <div class="yujing-source-popup">
            <div class="popup-header">
      <h3>{{ featureData.name || '地图要素' }}</h3>
      <span class="close-btn" @click="closePopup">×</span>
    </div>
    <div class="popup-body">
      <div class="pollution-info">
        <div class="info-item">
          <label>点位名称:</label>
          <span>{{ featureData.pointName || '未知' }}</span>
        </div>
        <div class="info-item">
          <label>行政区划:</label>
          <span>{{ featureData.county || '未知' }}</span>
        </div>
        <div class="info-item">
          <label>河流名称:</label>
          <span>{{ featureData.lakename || '未知' }}</span>
        </div>
                <div class="info-item">
          <label>点位地址:</label>
          <span>{{ featureData.pointAddress || '未知' }}</span>
        </div>
        <div class="info-item">
          <label>预警类型:</label>
          <span>{{ featureData.warnCategory && this.warnCategoryMap ? (this.warnCategoryMap[featureData.warnCategory]) : '未知' }}</span>
        </div>
    
        

      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'yujingPopup',
  data: function () {
    return {
      warnCategoryMap: {
       "1": '水环境',
        "2": '视频',
        "3": '在线监测'
      },

     
    };
  },
  props: {
    featureData: {
      type: Object,
      default: () => ({})
    }
  },

  methods: {
    closePopup() {
      this.$emit('close');
    }
  }
};
</script>

<style scoped>
.yujing-source-popup {
  min-width: 300px;
  max-width: 450px;
}

.popup-header {
  padding: 12px 16px;
  border-bottom: 1px solid #ebeef5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.popup-header h3 {
  margin: 0;
  font-size: 16px;
  color: #303133;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 30px);
}

.close-btn {
  cursor: pointer;
  font-size: 20px;
  color: #909399;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: #409eff;
}

.popup-body {
  padding: 16px;
}

.info-item {
  display: flex;
  margin-bottom: 10px;
  font-size: 14px;
}

.info-item:last-child {
  margin-bottom: 0;
}

.info-item label {
  width: 120px;
  color: #606266;
  font-weight: 500;
}

.info-item span {
  flex: 1;
  color: #303133;
}

.pollution-level {
  padding: 2px 6px;
  border-radius: 4px;
  color: white;
  font-weight: bold;
  font-size: 12px;
}
</style>